// app/schedule/price_monitor.js
exports.schedule = {
  cron: '0 0 8,12,18 * * *',
  type: 'worker'
};

exports.task = async function() {
  const { data: items } = await this.ctx.curl(`${this.config.zcyAPI}/price-list`, { dataType: 'json' }).catch(err => {
      this.ctx.logger.error('价格监控API请求失败:', err);
      return { data: [] };
    });
    if (!items || !items.length) return;
  const predictions = await this.ctx.service.ai.predictPriceTrend(items);

  predictions.filter(p => p.changeRate > 0.1)
    .forEach(p => {
      this.ctx.service.notify.sendPriceAlert(p);
    });
}